package com.mvm.store.domain.obj;

// Generated 05-Sep-2008 15:45:28 by Hibernate Tools 3.2.2.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Product generated by hbm2java
 */
@Entity
@Table(name = "product", catalog = "onstore")
public class Product implements java.io.Serializable {

	private String productid;
	private Category category;
	private String descendent;
	private String name;
	private Set<Item> items = new HashSet<Item>(0);

	public Product() {

	}

	public Product(String productid, Category category) {

		this.productid = productid;
		this.category = category;
	}

	public Product(String productid, Category category, String descendent, String name, Set<Item> items) {

		this.productid = productid;
		this.category = category;
		this.descendent = descendent;
		this.name = name;
		this.items = items;
	}

	@Id
	@Column(name = "productid", unique = true, nullable = false, length = 10)
	public String getProductid() {

		return this.productid;
	}

	public void setProductid(String productid) {

		this.productid = productid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "category", nullable = false)
	public Category getCategory() {

		return this.category;
	}

	public void setCategory(Category category) {

		this.category = category;
	}

	@Column(name = "descn")
	public String getDescendent() {

		return this.descendent;
	}

	public void setDescendent(String descendent) {

		this.descendent = descendent;
	}

	@Column(name = "name", length = 80)
	public String getName() {

		return this.name;
	}

	public void setName(String name) {

		this.name = name;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Item> getItems() {

		return this.items;
	}

	public void setItems(Set<Item> items) {

		this.items = items;
	}

}
